<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="utf-8">
	<title>签收订单</title>
	<meta name="viewport"
		  content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" th:href="@{/css/oksub.css}">
	<link rel="stylesheet" th:href="@{/layui_ext/dtree/dtree.css}">
	<link rel="stylesheet" th:href="@{/layui_ext/dtree/font/dtreefont.css}">
	<script type="text/javascript" th:src="@{/lib/loading/okLoading.js}"></script>
</head>
<body>
<div class="ok-body">
	<blockquote class="layui-elem-quote quoteBox">
		<form class="layui-form" lay-filter="searchForm">

<!--			<div class="layui-inline">-->
<!--				<a class="layui-btn layui-bg-cyan distOrder_btn">订单签收</a>-->
<!--			</div>-->

		</form>
	</blockquote>
	<!--数据表格-->
	<table class="layui-hide" id="tableId" lay-filter="tableFilter"></table>
</div>
<!--js逻辑-->
<script th:src="@{/lib/layui/layui.js}"></script>
<script th:inline="none">

	layui.extend({
		dtree: '/layui_ext/dtree/dtree'
	}).use(["element", "jquery", "table", "form", "laydate", "okLayer", "layer",
		"okUtils", "okMock","dtree"], function () {
		 table = layui.table;
		 form = layui.form;
		layer = layui.layer;
		 laydate = layui.laydate;
		 okLayer = layui.okLayer;
		 okUtils = layui.okUtils;
		 okMock = layui.okMock;
		 $ = layui.jquery;
		dtree = layui.dtree;

		laydate.render({
			elem: "#startTime",
			type: "datetime"
		});
		laydate.render({
			elem: "#endTime",
			type: "datetime"
		});
		okLoading.close($);
		var userTable = table.render({
			elem: '#tableId',
			url: "/api/orderList/sign",
			id: "orderList",
			page: true,
			toolbar: true,
			toolbar: "#toolbarTpl",
			size: "sm",
			cols: [[{
				type: "checkbox",
				fixed: "left"
			}, {
				field: "orderid",
				title: "订单编号",
				width: 100,
				sort: true
			},  {
				field: "assignBranchStaffName",
				title: "调派网点员工",
				width: 150
			}, {
				field: "caseNumber",
				title: "件数",
				width: 150
			}, {
				field: "weight",
				title: "重量",
				width: 150
			}, {
				field: "recipients",
				title: "收件人",
				width: 100
			}, {
				field: "recipientProvince",
				title: "收件省",
				width: 100
			}, {
				field: "recipientCity",
				title: "收件市",
				width: 100
			}, {
				field: "recipientArea",
				title: "收件区",
				width: 100
			}, {
				field: "recipientAddress",
				title: "收件地址",
				width: 100
			}, {
				field: "sender",
				title: "寄件人",
				width: 100
			}, {
				field: "province",
				title: "寄件人省",
				width: 100
			}, {
				field: "city",
				title: "寄件人市",
				width: 100
			}, {
				field: "area",
				title: "寄件人区",
				width: 100
			}, {
				field: "address",
				title: "寄件地址",
				width: 100
			}, {
				field: "addtime",
				title: "添加时间",
				width: 100
			}, {
				title : '录入状态',
				width : 130,
				templet : function(d) {
					if (d.catalogueState == "1") {
						return "未扫描完毕";
					}else if(d.catalogueState == "2"){
						return "扫描完毕";
					}else if(d.catalogueState == "3"){
						return "已派件";
					}else if(d.catalogueState == "4"){
						return "已签收"
					}
					return '';
				}
			}, {
				field: "waybillId",
				title: "运单编号",
				width: 100
			}]],
			done: function (res, curr, count) {
				console.info(res, curr, count);
			}
		});


		// //订单分配
		// $(".distOrder_btn").click(function() {
		// 	var checkData = table.checkStatus('orderList').data; //idTest 即为基础参数 id 对应的值
		// 	console.log(checkData);
		// 	if (checkData == null || checkData.length == 0) {
		// 		layer.msg("请先选中需要分配的订单", {
		// 			"icon" : 2
		// 		});
		// 		return;
		// 	}
		//
		// 	class_layer = layer.open({
		// 		type: 1,  //type:0 也行
		// 		title: "选择员工",
		// 		area: ["400px", "80%"],
		// 		content: '<ul id="staffTree" class="dtree" data-id="0"></ul>',
		// 		btn: ['确认选择'],
		// 		success: function(layero, index){
		//
		// 			var DTree = dtree.render({
		// 				//elem: "#staffTree",
		// 				obj: $("#staffTree"),
		// 				url: "/api/orderList/staffList",
		// 				dataStyle: "layuiStyle",  //使用layui风格的数据格式
		// 				dataFormat: "list" //配置data的风格为list
		// 			});
		//
		// 		},
		// 		yes: function(index, layero) {
		// 			var param = dtree.getNowParam("staffTree"); // 获取当前选中节点
		//
		// 			console.log(param.nodeId);
		// 			//将选中学生班级设置为选中的班级
		// 			//参数 班级id   选中的学生id
		//
		// 			var order_ids = new Array();
		//
		// 			for (var i = 0; i < checkData.length; i++) {
		// 				order_ids.push(checkData[i].orderid);
		// 			}
		// 			alert(order_ids)
		//
		// 			distOrder(param.nodeId, order_ids.join(","));
		// 		}
		// 	});
		//
		// });

		// //订单分配
		// function distOrder(sid,oids) {
		// 	$.get("/api/orderList/distOrder",{
		// 		staffId: sid,
		// 		ordersId: oids
		// 	},function(d) {
		// 		if (d.code == 200) {
		// 			layer.close(class_layer);
		// 			userTable.reload();
		//
		// 		} else {
		// 			layer.close(class_layer);
		// 			layer.msg(d.msg, {icon: 2});
		// 		}
		// 	});
		// }

	})


</script>

</body>
</html>
